Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix flaky snap test by adding multiple retries #141

Conversation

james-garner-canonical
Copy link
Contributor

@james-garner-canonical james-garner-canonical commented Jan 7, 2025

One test, test_snap_set_and_get_with_typed, often fails -- maybe 50% of the time. It fails when trying to ensure that the lxd snap is present on the latest version, raising a SnapError with the message 'Waiting for "snap.lxd.daemon.service" to stop'.

The existing code catches this once, waits 60 seconds and retries. Since the test often passes, this must sometimes be sufficient, so this PR simply uses slightly more robust retry logic -- retrying up to 10 times with 20 seconds in between each attempt. In 5/5 CI runs, this passed every time .

As a future CI improvement, it would be nice to improve test turnaround time by using snaps at versions that are already installed in the runner images as much as possible.

Resolves #123
Resolves #133

Copy link
Collaborator

@benhoyt benhoyt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the fixes!

@benhoyt benhoyt merged commit e20e313 into canonical:main Jan 8, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Integration tests are very inconsistent Fix failing test_snap_set_and_get_with_typed integration test
2 participants